<?php

class Yapary_Exception_ExceptionLog {

	private $oSql = NULL;

	private $oSqlResult = NULL;

	private $oData = NULL;

	private $tableName = 'yapary_exception_log';

	private $id;


	public function __construct(Yapary_Db_Sql_Connector $_oSql, $_id) {
		$this->oSql = $_oSql;
		$this->id = $_id;

		if (is_object($_id)) { // Bei Uebergabe eines Objekts wird dieses ohne weiteren Datenbankzugriff verwendet
			$this->oData = $_id;
		} else {
			$this->oSqlResult = $this->oSql->request("SELECT *
													FROM ".$this->tableName." t
													WHERE t.Id=:id
													",
													array(
															'id'	=> $_id
													));
			$this->oData = $this->oSqlResult->getNext();
		}
	}


	public function exists() {
		if (is_object($this->oData)) {
			return true;
		}

		return false;
	}


// 	public function getCategoryId() {
// 			if (!$this->exists()) {
// 			return NULL;
// 		}

// 		return $this->oData->CategoryId;
// 	}


	public function getId() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->Id;
	}


	public function getIP() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->IP;
	}


	public function getHost() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->Host;
	}


	public function getUserAgent() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->UserAgent;
	}


	public function getPosition() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->Position;
	}


	public function getExceptionTrace() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->ExceptionTrace;
	}


	public function getCount() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->Count;
	}


	public function getFirstDateTime() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->FirstDateTime;
	}


	public function getLastDateTime() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->LastDateTime;
	}


	public function getStatus() {
		if (!$this->exists()) {
			return NULL;
		}

		return $this->oData->Status;
	}








}


?>